﻿
@{
    ViewBag.Title = "Feature 3: Admin Crud";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="row" ng-controller="cityController">
    <h3>Welcome to Admin update page</h3>
    <div class="col-md-8">
        <table class="table table-striped table-responsive table-condensed">
            <tr>
                <th>
                    CountryId
                </th>
                <th>
                    Country Name
                </th>
                <th>
                    CityId
                </th>
                <th>
                    City Name
                </th>
                <th>
                    Temperature(avg)
                </th>
                <th></th>
            </tr>
            <tr ng-repeat="c in Cities">
                @*ng-click="get(c)" :click row to display data instead of clicking edit*@
                <td>
                    {{c.CountryId}}
                </td>
                <td>
                    {{c.CountryName}}
                </td>
                <td>
                    {{c.CityId}}
                </td>
                <td>
                    {{c.CityName}}
                </td>
                <td>
                    {{c.Temperature}}
                </td>
                <td>
                    <button class="btn btn-sm btn-info" ng-click="get(c)">Edit</button>&nbsp;
                    @*<button class="btn btn-danger" ng-click="delete(c.CityId)">Delete</button>*@
                </td>
            </tr>
        </table>
    </div>
    <div class="col-md-4">
        <form class="form-horizontal">
            <div class="form-group">
                <label for="CountryId" class="col-md-4">CountryId</label>
                <input type="text" Id="CountryId" ng-model="CountryId" class="form-control col-md-8" readonly="readonly"/>
            </div>
            <div class="form-group">
                <label for="CountryName" class="col-md-4">CountryName</label>
                <input type="text" Id="CountryName" ng-model="CountryName" class="form-control col-md-8" readonly="readonly"/>
            </div>
            <div class="form-group">
                <label for="CountryName" class="col-md-4">CityId</label>
                <input type="text" Id="CityId" ng-model="CityId" class="form-control col-md-8" readonly="readonly"/>
            </div>
            <div class="form-group">
                <label for="CountryName" class="col-md-4">CityName</label>
                <input type="text" Id="CityName" ng-model="CityName" class="form-control col-md-8" readonly="readonly"/>
            </div>
            <div class="form-group">
                <label for="Temperature" class="col-md-4">Temperature</label>
                <input type="text" Id="Temperature" ng-model="Temperature" class="form-control col-md-8"/>
            </div>
            @*<button class="btn btn-primary" ng-click="clear()">New</button>*@
            <button class="btn btn-success" ng-click="save()">Save</button>
        </form>
        <br/>
        <p class="lead">{{Message}}</p>
    </div>
</div>


@section scripts{
    <script src="~/Scripts/Directives/directives.js"></script>
    <script src="~/Scripts/Filters/filters.js"></script>
    <script src="~/Scripts/App/app.js"></script>
    <script src="~/Scripts/Services/cityService.js"></script>
    <script src="~/Scripts/Controllers/cityController.js"></script>
}
